<%--
  - Author		:	Jaewon Choi
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});
		</script>
	</head>
	<body>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="menuTitle">
					이벤트상세보기
				</div>
				<form id="frm" name="frm" method="post" action="<c:url value="/event/form.do" />">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchDate" value="${param.searchDate}">
					<input type="hidden" name="startDate" value="${param.startDate}" /> 
					<input type="hidden" name="endDate" value="${param.endDate}" />
					<input type="hidden" name="searchName" value="${param.searchName}" />
					
					<table class="frmTbl">
						<colgroup>
							<col width="176px;" />
							<col width="*" />
							<col width="100px;" />
						</colgroup>
						<tbody>
			 				<tr>
								<th>이벤트 IDX</th>
								<td colspan="2">
									${event.idx}
									<input type="hidden" name="idx" value="${event.idx}">
								</td>
							</tr>
							<tr>
								<th>브랜드</th>
								<td>
									<c:out value="${event.categoryNm}" />
								</td>
							</tr>
							<tr>
								<th>기간</th>
								<td colspan="2">
									<c:choose>
										<c:when test="${not empty event.beginTime and not empty event.endTime}">
											<c:catch var="e">
												<fmt:parseDate var="beginTime" pattern="yyyy-MM-dd HH:mm:ss" value="${event.beginTime}" />
												<fmt:formatDate var="beginTime" value="${beginTime}" pattern="yyyy-MM-dd" />
											</c:catch>
											<c:if test="${not empty e}">
												<c:set var="beginTime" value="${event.beginTime}" />
											</c:if>
											<c:catch var="e">
												<fmt:parseDate var="endTime" pattern="yyyy-MM-dd HH:mm:ss" value="${event.endTime}" />
												<fmt:formatDate var="endTime" value="${endTime}" pattern="yyyy-MM-dd" />
											</c:catch>
											<c:if test="${not empty e}">
												<c:set var="endTime" value="${event.endTime}" />
											</c:if>
											<c:out value="${beginTime}" /> ~ <c:out value="${endTime}" />
										</c:when>
										<c:otherwise>
											항상
										</c:otherwise>
									</c:choose>
								</td>
							</tr>
							<tr>
								<th>이벤트명</th>
								<td colspan="2">
									<c:out value="${event.name}" />
								</td>
							</tr>
							<!-- <tr>
								<th>엠블럼</th>
								<td colspan="2">
									<c:choose>
										<c:when test="${event.emblem eq 'N'}">NEW</c:when>
										<c:when test="${event.emblem eq 'E'}">EVENT</c:when>
										<c:when test="${event.emblem eq 'S'}">SPECIAL</c:when>
										<c:when test="${event.emblem eq 'H'}">HOT</c:when>
										<c:when test="${event.emblem eq 'X'}">없음</c:when>
										<c:otherwise>${event.emblem}</c:otherwise>
									</c:choose>
								</td>
							</tr>
							 -->
							<tr>
								<th>빅배너</th>
								<td colspan="2">
									<c:if test="${not empty bigBanner[0].fileUrl}">
										<img src="${bigBanner[0].fileUrl}" class="thumbnailImg" />
									</c:if>
								</td>
							</tr>
							<tr>
								<th>스몰배너</th>
								<td colspan="2">
									<c:if test="${not empty smallBanner[0].fileUrl}">
										<img src="${smallBanner[0].fileUrl}" class="thumbnailImg" />
									</c:if>
								</td>
							</tr>
							<tr>
								<th>상세 이미지</th>
								<td colspan="2">
									<c:if test="${not empty detail[0].fileUrl}">
										<img src="${detail[0].fileUrl}" class="thumbnailImg" />
									</c:if>
								</td>
							</tr>
							<tr>
								<th>이벤트 링크</th>
								<td colspan="2">
									<c:out value="${event.linkUrl}" />
								</td>
							</tr>
							<!-- <tr>
								<th>메인 노출 여부</th>
								<td colspan="2">
									<c:choose>
										<c:when test="${event.isMain eq '1'}">Yes</c:when>
										<c:when test="${event.isMain eq '0'}">No</c:when>
										<c:otherwise>${event.isMain}</c:otherwise>
									</c:choose>
								</td>
							</tr>
							<tr>
								<th rowspan="${fn:length(mainImgs)+1}">메인 이미지</th>
								<th>이미지 파일</th>
								<th>엠블럼</th>
							</tr>
							<c:forEach var="mainImg" items="${mainImgs}" varStatus="stat">
								<tr>
									<td>
										<img src="${mainImg.fileUrl}" class="thumbnailImg" />
									</td>
									<td>
										<c:set var="emblem" value="${fn:split(mainImg.fileData, '^')[4]}" />
										<c:choose>
											<c:when test="${emblem eq 'N'}">NEW</c:when>
											<c:when test="${emblem eq 'E'}">EVENT</c:when>
											<c:when test="${emblem eq 'S'}">SPECIAL</c:when>
											<c:when test="${emblem eq 'H'}">HOT</c:when>
											<c:when test="${emblem eq 'X'}">없음</c:when>
											<c:otherwise>${emblem }</c:otherwise>
										</c:choose>
									</td>
								</tr>
							</c:forEach> -->
						</tbody>
					</table>
					<input type="button" class="btn" value="목록" onclick="javascript:document.listFrm.submit();" />
					<input type="submit" class="btn" value="수정" />
				</form>
				<form name="listFrm" action="<c:url value="/event/list.do" />" method="post" style="display: none;">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchDate" value="${param.searchDate}">
					<input type="hidden" name="startDate" value="${param.startDate}" /> 
					<input type="hidden" name="endDate" value="${param.endDate}" />
					<input type="hidden" name="name" value="${param.searchName}" />
				</form>
			</div>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
		</div>
	</body>
</html> 